package com.pimee.common.constants;

public class Constants {
	/**
	 * 公共状态
	 * 
	 * @author Bruce Shaw 2020年2月5日 下午9:24:59
	 *
	 */
	public enum CommonStatus {
		SUC("0", "成功"), FAIL("1", "失败");

		private final String code;
		private final String msg;

		private CommonStatus(String code, String msg) {
			this.code = code;
			this.msg = msg;
		}

		public String getCode() {
			return code;
		}

		public String getMsg() {
			return msg;
		}

	}

	public static class DataType {
		public static final String STRING = "java.lang.String";
		public static final String BOOLEAN = "java.lang.Boolean";
		public static final String INTEGER = "java.lang.Integer";
		public static final String DOUBLE = "java.lang.Double";
		public static final String FLOAT = "java.lang.Float";
		public static final String LONG = "java.lang.Long";
		public static final String BIGDECIMAL = "java.math.BigDecimal";
		public static final String DATE = "java.util.Date";
		public static final String TIME = "java.sql.Time";
		public static final String TIMESTAMP = "java.sql.Timestamp";
	}

	public static class Web {
		/**
		 * 异常信息统一头信息<br>
		 * 非常遗憾的通知您,程序发生了异常
		 */
		public static final String Exception_Head = "SOME ERRORS OCCURED! AS FOLLOWS :";
		/** 操作名称 */
		public static final String OPERATION_NAME = "OPERATION_NAME";
		/** 客户端语言 */
		public static final String USERLANGUAGE = "userLanguage";
		/** 客户端主题 */
		public static final String WEBTHEME = "webTheme";
		/** 当前用户 */
		public static final String CURRENT_USER = "CURRENT_USER";
		/** 客户端信息 */
		public static final String USER_AGENT = "USER-AGENT";
		/** 客户端信息 */
		public static final String USER_IP = "USER_IP";
		/** 上次请求地址 */
		public static final String PREREQUEST = "PREREQUEST";
		/** 上次请求时间 */
		public static final String PREREQUEST_TIME = "PREREQUEST_TIME";
		/** 登录地址 */
		public static final String LOGIN_URL = "/admin/login";
		/** 非法请求次数 */
		public static final String MALICIOUS_REQUEST_TIMES = "MALICIOUS_REQUEST_TIMES";
		/**
		 * 资源映射路径 前缀
		 */
		public static final String RESOURCE_PREFIX = "/profile";
	}

	public static class Shiro {
		/**
		 * 当前登录的用户
		 */
		public static final String CURRENT_USER = "currentUser";

		/**
		 * 用户名
		 */
		public static final String CURRENT_USERNAME = "username";
		// 在线session
		public static final String ONLINE_SESSION = "ONLINE_SESSION";

	}

	/**
	 * 用户会话
	 * 
	 * @author Bruce Shaw 2020年2月5日 下午9:24:47
	 *
	 */
	public enum OnlineStatus {
		/** 用户状态 */
		OFFLINE("0", "离线"), ONLINE("1", "在线");

		private final String code;
		private final String msg;

		private OnlineStatus(String code, String msg) {
			this.code = code;
			this.msg = msg;
		}

		public String getCode() {
			return code;
		}

		public String getMsg() {
			return msg;
		}

	}

	public enum ScheduleStatus {
		/** 定时作业状态 */
		NORMAL("0", "正常"), PAUSE("1", "停止");

		private final String code;
		private final String msg;

		private ScheduleStatus(String code, String msg) {
			this.code = code;
			this.msg = msg;
		}

		public String getCode() {
			return code;
		}

		public String getMsg() {
			return msg;
		}
	}

	public enum TaskCode {
		TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE
	}

	public static class File {
		/**
		 * 资源映射路径 前缀
		 */
		public static final String RESOURCE_PREFIX = "/profile";
	}

	/**
	 * 任务调度
	 * 
	 * @author Bruce Shaw 2020年2月5日 下午9:15:41
	 *
	 */
	public static class Schedule {

		public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";

		/** 执行目标key */
		public static final String TASK_PROPERTIES = "TASK_PROPERTIES";

		/** 默认 */
		public static final String MISFIRE_DEFAULT = "0";

		/** 立即触发执行 */
		public static final String MISFIRE_IGNORE_MISFIRES = "1";

		/** 触发�?次执�? */
		public static final String MISFIRE_FIRE_AND_PROCEED = "2";

		/** 不触发立即执�? */
		public static final String MISFIRE_DO_NOTHING = "3";
	}

	/**
	 * 数据源类型
	 * 
	 * @description
	 * @author Bruce Shaw 2020年2月9日 下午3:54:22
	 */
	public enum DataSourceType {
		/**
		 * 主库
		 */
		MASTER,
		/**
		 * 从库
		 */
		SLAVE
	}

	public class CacheKey {
		public static final String SHIRO_SESSION_KEY = "shiro:session:key";
		
		public static final String SYS_CONFIG = "sys:config";
		
		/***
		 * session key
		 */
		public static final String USER_SESSION_KEY = "admin:user:session:key";
	}

}
